<& blognav.mas, storyId => $id, page => $header &>
% if ($ipAccess) {
% }
<% $dateCreated %>
% if ($author) {
by <% $author %>
% }
% if (($status) or (($ipAccess) and (!$status))) {
<% $copy %>
% }
<%init>
my ($sql, $sth);
my $dbh = $m->comp('/dbconnect.mas');
## DETERMINE IF ACCESS IS ALLOWED FROM ADAGIO EMPLOYEE IP
my $ipAccess = $m->comp('../../adagio/lib/ip_access.mas', page=>'blog_lardera');
## WHITELIST SEO CONSULTANT IP
if ($ENV{'HTTP_X_FORWARDED_FOR'} eq "188.78.244.196") {$ipAccess = 1;}
my $id = $ARGS{id};
if (index($id, '/')>0){
$id = substr($id, 0, index($id, '/'));
}
$sql = qq|
SELECT
ID,
ID_NICE,
DATE_FORMAT(DATE_CREATED, '%M %d, %Y'),
IMAGE,
HEADER,
TEASER,
COPY,
AUTHOR,
AUTHOR_LINK,
STATUS
FROM
blog_lardera
WHERE
ID = ?
LIMIT
1
|;
$sth = $dbh->prepare($sql);
$sth->execute($id);
my ($bid, $bidnice, $dateCreated, $image, $header, $teaser, $copy, $author, $authorLink, $status) = $sth->fetchrow_array();
if (index($ENV{'QUERY_STRING'}, '/') == -1 && length($bidnice)>1){
my $newUrl = "/blog/$bid/$bidnice";
$m->clear_buffer;
# set the HTTP status to 301
$r->status(301);
# set the Location header to your target URL
$r->headers_out->add( Location => $newUrl );
# tell Mason to finish the request and return that status
return 301;
}
$copy =~ s/\n/